﻿using System.Collections.Generic;
using System.Text;

namespace RbmlVisualizer.Data.Blocks
{
    public class Classifier : IMultiplicity
    {
        public Classifier()
        {
            AttributeRoles = new List<ClassifierAttribute>();
            BehaviorRoles = new List<ClassifierBehavior>();

        }

        public bool IsConcrete { get; set; }
        public List<ClassifierBehavior> BehaviorRoles { get; set; }
        public List<ClassifierAttribute> AttributeRoles { get; set; }
        public string Name { get; set; }
        public Multiplicity Multiplicity { get; set; }



        public override string ToString()
        {
            //TODO do more in depth string representation
            StringBuilder stringBuilder = new StringBuilder();
            stringBuilder.Append(this.Name);
            return stringBuilder.ToString();
        }

        public override int GetHashCode()
        {
            //We're saying the name uniquely identifes the Classifier
            return Name.GetHashCode();
        }

        public override bool Equals(object obj)
        {
            return Equals(obj as Classifier);
        }

        public bool Equals(Classifier classifier)
        {
            if (classifier == null)
                return false;

            return Name == classifier.Name; 
        }
    }
}
